package com.springboot.springbootnetty;

import com.springboot.springbootnetty.nettyservice.NettyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.net.InetSocketAddress;

@SpringBootApplication
public class SpringbootNettyApplication  implements CommandLineRunner {
    @Autowired
    private NettyService nettyService;
    public static void main(String[] args) {
        SpringApplication.run(SpringbootNettyApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        // 如果部署到线上环境，需要修改为内网IP
//        InetSocketAddress inetSocketAddress = new InetSocketAddress("192.168.2.63", 6669);
        InetSocketAddress inetSocketAddress = new InetSocketAddress("127.0.0.1", 6669);
        nettyService.NettyServer(inetSocketAddress);
    }

}
